Use the Import Data dialog box to select the options you want to use when importing model data from a linked Excel file. For more information, see Setting Up Import Links.
To open the Import Data dialog box, choose Import Data from the Model menu.
Click on this button to create a template for importing all model constants and graphical functions. This will open the Create Import Template dialog box and allow you to generate a file with all the potentially importable model variables laid out in the appropriate format.
Each link is shown in a separate row. If this list is empty, the dialog will open with an empty link, otherwise use the button to add a new link. Click on a row to set up information about the link by editing the items below the list (except for the active checkbox which you click on directly in the row). To remove a link, click on the row you want to remove, and then click on the button.
Valid
This column indicates whether the data source you've specified exists and can be read. It will say No until you select a source, and will also say No if you have an existing link, but the file is missing or unreadable.
Active
Check this option to enable the link for Import All on this dialog, and for automatic import if Dynamic is selected. If this is not checked only the import button at the right will cause data to be imported.
Source
This specifies the file from which the software will read the data. Click on the Browse button to open a File Selection dialog and choose a file. If the file can't be used, most commonly because all its worksheets are already specified for importing or exporting data, an error message will appear.
Note: The file should be located in the same directory as the model, or a subdirectory of the model directory, named data. If you use a file from a different location, copying the model to a different computer will likely make the link invalid.
Worksheet
This option is only applicable to Excel files. After you've selected the file, the first available worksheet it contains will be shown. Click on the dropdown to select the sheet you want..
Note: You can only choose worksheets not already in use by other import or export links. If there's a single worksheet available, it will be the only one shown. If all the worksheets are in use you will get a message stating this.
Note If you add a sheet to an Excel workbook with this dialog open, the new sheet may not be recognized. Close and reopen the dialog. If that fails close and reopen Stella.
Note If you are importing data from an Excel file that came from another computer or via email you should first open the file in Excel before asking Stella to operate on it. Otherwise you may get security warnings that cause importing to fail. This is especially true on the Macintosh.
Type/Link Type
- On Demand, if selected, means data will only be imported if you open this dialog and select Import Now ( ). This option is only available if the import behavior is to overwrite parameter values or set dimensions.
- Dynamic, if selected, will cause the data to be imported each time the model is simulated, or the data source is changed when parameters are being overwritten or dimensions set.
Import Behavior
- Overwrite parameter equations will cause the imported data to change the equations for any constant or graphical in the model. Any variables in the import source that are not constants or graphicals will be ignored.
- Control variables will cause the imported data to control variable values, during the simulation, but not to make any changes to the equation. If a variable is not a constant, the value in the source will be used in place of the computed equation (though flows may be constrained). Stock values will be used to initialize the stocks.
- Set array dimensions will cause the imported data to replace the definitions of array dimensions. Since this will change model structure, the undo history will be reset so use this option with care. For more discussion see Setting Up Import Links Names that are not dimensions will be ignored.
- Load Time Varying Values allows you to bring in a sequence of values over time to control a variable. This is useful for bringing in a sequence of control values to run scenarios and also for bringing in data that can be used in calibration (see Defining Calibration Payoffs). When a model is run the time varying values will be computed according to the following choice:
- Continuous will cause values to be interpolated between the included data points and will use the first value before the first time point and the last value after the last.
- Inside will cause values to be interpolated between the included data points and will use the equation's value before the first time point and the last after the last time point. This is most useful for driving variables with historic data then have the equation be used when projecting forward.
- Extrapolated is the same as continuous, but before the first point the slope of the line between the first and second point will be continued, and after the last point the slope of the line between the second last and last will be continued.
- Discrete (backward) will use the value of each time point until the next time point is reached and then use that value. Before it uses the value of the first and after the value of the last time point.
- Discrete (forward) will use the value of the coming time point once a time point is passed. Before it uses the value of the first and after the value of the last time point.
- Raw, will use the value of the time points that are in the data, and otherwise will use the computed value (equation) for the variable. Set the variable equation to NAN to get only the values in the imported data.
Note When used in calibration the different choices for time varying parameters do not matter, only the actual data points imported are used.
Note You can override the interpolation mode for individual imported variables by following their name by :c for continuous, :i for inside, :e for extrapolated, :b for backward, :f for forward and :r for raw (that is, using var[1,3]:e instead of var[1,3] in the first row or column of the import csv or Excel file).
Import
Click on the button to import from the designated link. The import will be attempted regardless of the Enabled and Dynamic settings. A message will be shown about the success of, or problems with, the import.
Click this button to import from all of the links that are marked active. This will happen whether the links are marked dynamic or not. A message will be displayed showing the results of all the imports. If you have many links, this is a convenient way to check that they're all working as expected.
Click OK to save the changes you've made to links. Click Cancel to discard them. If you've executed any imports, the data from those will still be in your model.
Note: Importing data is not part of the Undo/Redo system. Once you've imported a value, then the associated equation for the constant, or the graphical function's list of points, will be permanently changed for links that overwrite parameters.